package org.example.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor // 全参构造方法
@NoArgsConstructor // 无参构造方法
public class AjaxResult {

    private int code;
    private String message;
    private Object data;

    public static AjaxResult ok(){
        return new AjaxResult(200,"success",null);
    }

    public static AjaxResult ok(Object data){
        return new AjaxResult(200,"success",data);
    }

    public static AjaxResult error(){
        return new AjaxResult(500,"error",null);
    }

    public static AjaxResult error(int code,String message){
        return new AjaxResult(code,message,null);
    }

    public static AjaxResult error(String message){
        return new AjaxResult(500,message,null);
    }

}
